package com.manage.demo.service;


import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.manage.demo.dao.teacherMapper;
import com.manage.demo.dao.model.CourseInfo;
import com.manage.demo.dao.model.TeacherInfo;
@Service
@Transactional
public class TeacherService {

	@Autowired
	private teacherMapper teacherMapper;
	
	public List<Map<String, Object>> getTeacherListByCondition(String subject, String id, int limit, int offset) {
		return teacherMapper.getTeacherListByCondition(subject, id, limit, offset);
	}
	
	public Integer getAdministratorByCondition(String id) {
		return teacherMapper.getAdministratorByCondition(id);
	}
	
	public List<Map<String, Object>> getTeacherMange(String id) {
		return teacherMapper.getTeacherMange(id);
	}

	public List<Integer> getTeacherIdByCondition(Integer id) {
		return teacherMapper.getTeacherIdByCondition(id);
	}
	
	public Integer setTeacherByCondition(String newid, String name, String sex, String tel, String subject) {
		return teacherMapper.setTeacherByCondition(newid, name, sex, tel, subject);
	}
	
	public Integer setUserByCondition(String newid, String administrator) {
		return teacherMapper.setUserByCondition(newid, administrator);
	}
	
	@Transactional
	public Integer update(String id, String name, String sex, String tel, String subject) {
		return teacherMapper.updateTeacher(id, name, sex, tel, subject);
	}
	
	@Transactional
	public Integer updateUser(String id, String administrator) {
		return teacherMapper.updateUser(id, administrator);
	}

	@Transactional
	public Integer delete(String id) {
		return teacherMapper.deleteTeacher(id);
	}
	
	@Transactional
	public Integer deleteUser(String id) {
		return teacherMapper.deleteUser(id);
	}
	
	@Transactional
	public List<Map<String, String>> getcourse() {
		return teacherMapper.getcourse();
	}
	
	public List<Map<String, Object>> getCount(String subject, String id) {
		return teacherMapper.getCount(subject, id);
	}
}
